<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="width=device-width, initial-scale=0.5"/>
    <title>审批请假</title>
    <script src="/static/bflow/assets/js/scriptLib.js"></script>
    <script src="/static/bflow/assets/My97DatePicker/WdatePicker.js" type="text/javascript"></script>
    <!-- bootstrap-validator -->
    <script src="https://cdn.bootcss.com/1000hz-bootstrap-validator/0.11.9/validator.min.js"></script>
    <script src="/static/bflow/assets/js/bflow/example/leaveView.js"></script>
    <script src="/static/bflow/assets/js/bflow/common/auditUtil.js"></script>
    <script type="text/javascript">

        $(function () {
            //初始化数据
            initViewAndAuditData();

            setTimeout(function () {
                // 表单验证 http://1000hz.github.io/bootstrap-validator/
                $('#auditForm').validator().on('submit', function (e) {
                    if (e.isDefaultPrevented()) {
                        // handle the invalid form...
                    } else {
                        submitAuditForCommon("/example/leave/audit", function (message) {
                            refreshPage(1500, '/static/bflow/ui/example/leave/list.html');
                        })
                        return false;
                    }
                });
            }, 500);

        });

        function initViewAndAuditData(){
            var id = getBrowserQueryVar("taskId");
            if(CommUtil.isNotEmpty(id)){
                HttpUtil.ajaxAsyncJsonPost("/example/leave/getTask", {taskId: id}, function(data){
                    console.log("data", data);
                    var instance = data.instance;
                    FormUtil.bindViewData("viewTable", instance);
                    $("#status").html(getCommStatusLabel(instance.status));
                    //请假流程记录
                    buildRecordList(instance.records);
                    $("#taskId").val(data.id);
                    buildAuditRouteGroup("routeGroup", data.actRoutes)
                });
            }
        }
    </script>
</head>
<body>
<div class="container">
    <div class="page-header">
        <h1>请假
            <small><a href="/index.html" class="btn btn-link">首页</a></small>
        </h1>
    </div>
    <ul class="nav nav-tabs">
        <li><a href="/static/bflow/ui/example/leave/list.html"><span>全部请假记录</span></a></li>
        <li><a href="/static/bflow/ui/example/leave/myList.html"><span>我的请假记录</span></a></li>
        <li><a href="/static/bflow/ui/example/leave/copyToMeList.html"><span>抄送给我的请假申请</span></a></li>
        <li class=""><a href="/static/bflow/ui/example/leave/auditList.html">待审批</a></li>
        <li class="active"><a>审批</a></li>
    </ul>

    <table id="viewTable" class="table table-bordered">
        <tbody>
        <tr><th>审批编号:</th><td id="procKey"></td></tr>
        <tr> <th>请假人:</th><td id="startUname"></td></tr>
        <tr> <th>请假人角色名称:</th><td id="startURoleName"></td></tr>
        <tr><th>请假类型:</th><td id="extVarchar2"></td></tr>
        <tr><th>开始时间:</th><td id="extDatetime1"></td></tr>
        <tr><th>结束时间:</th><td id="extDatetime2"></td></tr>
        <tr><th>请假天数&nbsp;&nbsp;(天)&nbsp;&nbsp;:</th><td id="extNumeric1"></td></tr>
        <tr><th>请假事由:</th><td id="extVarchar1"></td></tr>
        <tr><th>流程状态:</th><td id="statusName"></td></tr>
        <tr><th>修改时间:</th><td id="updateTime"></td></tr>
        <tr><th>抄送人姓名:</th><td id="copyToUserName"></td></tr>
        <tr><th>审批记录:</th>
            <td class="audit-record-panel">
                <table>
                    <tbody id="processRecordTableTbody" class="audit-record-list"></tbody>
                </table>
            </td>
        </tr>
        </tbody>
    </table>
    <div class="col-sm-offset-2">
        <h4 class="h4">审批操作</h4>
        <script src="/static/bflow/assets/js/tpl/auditFormTpl.js"></script>
    </div>
</div>
</body>
</html>

